/**  
 * All rights Reserved, Designed By Soywer   
 * @Title:  UserInfoMapping.java   
 * @Package vinux.web.common.es.mapping   
 * @Description:    TODO(用一句话描述该文件做什么)   
 * @author: Soywer     
 * @date:   2016年11月4日 下午3:12:01   
 * @version V1.0     
 */  
package vinux.web.common.es.mapping;

import org.elasticsearch.common.xcontent.XContentBuilder;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;

import java.io.IOException;
/**   
 * @ClassName:  UserInfoMapping   
 * @Description:TODO(用户索引)   
 * @author: Soywer  
 * @date:   2016年11月4日 下午3:12:01   
 *      
 */
public class UserInfoMapping {
	public static XContentBuilder getMapping(){
		XContentBuilder mapping = null;
		try {
			mapping = jsonBuilder()
			.startObject()
				//开启倒计时功能
				.startObject("_ttl").field("enabled",false).endObject()
				.startObject("properties")
					.startObject("id").field("type","long").field("index","not_analyzed").endObject()
					.startObject("userid").field("type","long").field("index","not_analyzed").endObject()
					.startObject("name").field("type","string").field("index","not_analyzed").endObject()
					.startObject("userloginname").field("type","string").field("index","not_analyzed").endObject()
					
					.startObject("age").field("type","string").field("index","not_analyzed").endObject()
					.startObject("headphoto").field("type","string").field("index","not_analyzed").endObject()
					.startObject("address").field("type","string").field("index","not_analyzed").endObject()
					.startObject("gender").field("type","string").field("index","not_analyzed").endObject()
					.startObject("phonenumber").field("type","string").field("index","not_analyzed").endObject()
					.startObject("idcard").field("type","string").field("index","not_analyzed").endObject()
					.startObject("proportion").field("type","string").field("index","not_analyzed").endObject()
					.startObject("pensionindex").field("type","string").field("index","not_analyzed").endObject()
					.startObject("buycount").field("type","string").field("index","not_analyzed").endObject()
					.startObject("communityid").field("type","string").field("index","not_analyzed").endObject()
					.startObject("communityamountperson").field("type","string").field("index","not_analyzed").endObject()
					
					.startObject("buyamount").field("type","string").field("index","not_analyzed").endObject()
					.startObject("foundationcommunity").field("type","string").field("index","not_analyzed").endObject()
					.startObject("createtime").field("type","long").field("index","not_analyzed").endObject()
					.startObject("lastupdatetime").field("type","long").field("index","not_analyzed").endObject()
					.startObject("usertype").field("type","string").field("index","not_analyzed").endObject()
					.startObject("status").field("type","string").field("index","not_analyzed").endObject()
					.startObject("pensionedtime").field("type","long").field("index","not_analyzed").endObject()
					
				.endObject()
			.endObject();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return mapping;
	}
}
